//组件状态管理-useState

import { useState } from "react";

const App = () => {
  const obj = {
    name: "zs",
    age: 18,
  };
  const [value, setValue] = useState(obj);
  const hObj = () => {
    setValue({
      ...value,
      name: "李四",
    });
  };
  //name: "李四"和...value,这两个都顺序会影响覆盖
  return (
    <>
      <p>{value.name}</p>
      <button onClick={hObj}>修改对象的name属性值</button>
    </>
  );
};
export default App;
